package tc.de.krawallmann.extension;

import java.io.File;

/**
 * Checks if the given file exists.
 * 
 * @author KrawallMann
 * @version 1.0
 */
public class FileExistenceChecker implements Extension {
	
	/** The game directory. */
	private transient final String gameDirectory;

	/**
	 * Instantiates a new file existence checker.
	 * 
	 * @param gameDirectory
	 *            the game directory
	 */
	public FileExistenceChecker(final String gameDirectory) {
		super();
		this.gameDirectory = gameDirectory;
	}

	/* (non-Javadoc)
	 * @see tc.de.krawallmann.extension.Extension#init()
	 */
	@Override
	public void init() {
		if (!new File(gameDirectory).exists()) {
			new File(gameDirectory).mkdirs();
		}
	}

	/* (non-Javadoc)
	 * @see tc.de.krawallmann.extension.Extension#update(long)
	 */
	@Override
	public void update(final long delta) {
		// Not needed!
	}

}
